revXMLMatchingNode
Type
function
Summary
Finds the node in an XML tree where the specified attribute of the node has the specified value.
Syntax
revXMLMatchingNode(<treeID>, <startNode>, <childName>, <attributeName>, <attributeValue>, <depth> [, <caseSensitive>])
Description
Use the revXMLMatchingNode function to search for a node by its attributes.
If the revXMLMatchingNode function encounters an error, it returns an error message starting with "xmlerr".
The revXMLMatchingNode function is part of the XML library. To ensure that the function works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.
Parameters
Name | Type | Description |
---|---|---|
treeID | The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree. | |
startNode | The path to the node where you want to start. | |
childName | string | A string specifying which child nodes to scan. If it is empty, all child nodes are scanned. Otherwise, only child nodes whose name matches the childName are scanned. |
attributeName | The name of the attribute you want to examine. | |
attributeValue | The value that the attributeName must have to be found. | |
depth | The depth specifies how many generations to scan. If you specify 1, the parentNode's child nodes are scanned, but not their child nodes. To scan all generations, specify -1 as the depth. | |
caseSensitive | bool | True or false and determines whether the attributeValue should be compared in a case-sensitive manner or not. If caseSensitive is not specified, then case is ignored when comparing attribute values (i.e. defaults to false). |
Examples
revXMLMatchingNode(1,revXMLRootNode(1),,"PubYear","2001",-1)
put revXMLMatchingNode(thisTree,it,field "Category",thisAttr,"Yes",4) after tFoundNodePaths
Related
library: XML library
control structure: function
function: revXMLAttributeValues, revXMLChildNames, revXMLTree, revXMLAttributes
glossary: LiveCode custom library, node, Standalone Application Settings, standalone application, XML tree, return, attribute
Compatibility and Support
Introduced
LiveCode 2.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile